﻿//https://leetcode.cn/problems/subsets/?envType=study-plan-v2&envId=top-100-liked

class Solution {
    int n;
    vector<vector<int>> ret;
    vector<int> path;
public:
    vector<vector<int>> subsets(vector<int>& nums)
    {
        n = nums.size();
        dfs(nums, 0);
        return ret;
    }

    void dfs(vector<int>& nums, int pos)
    {
        ret.push_back(path);
        if (pos == n)
            return;

        for (int i = pos; i < n; i++)
        {
            path.push_back(nums[i]);
            dfs(nums, i + 1);
            path.pop_back();
        }
    }
};
